# Maintainer: Andrew Sun <adsun701@gmail.com>

_realname=fcrackzip
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.0
pkgrel=1
pkgdesc="Zip file password cracker (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="http://oldhome.schmorp.de/marc/${_realname}.html"
license=('GPL')
source=("http://oldhome.schmorp.de/marc/data/${_realname}-${pkgver}.tar.gz")
sha256sums=('4a58c8cb98177514ba17ee30d28d4927918bf0bdc3c94d260adfee44d2d43850')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-static \
    --enable-shared

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
  mv "${pkgdir}${MINGW_PREFIX}/bin/zipinfo.exe" "${pkgdir}${MINGW_PREFIX}/bin/fzipinfo.exe"
}
